﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RobbyPanelItem : MonoBehaviour
{
    public Text m_NameL;
    public Text m_NumberL;
    public DiscoveryResponse Info {
        set {
            m_Info = value;
            if(m_Info != null)
            {
                m_NameL.text = m_Info.name;
                m_NumberL.text = m_Info.numPlayers + "/" + m_Info.numPlayersMax;
            }
            else
            {
                m_NameL.text = "";
            }
        }
        get { return m_Info; } }

    public delegate void CallbackResponse(DiscoveryResponse value);
    public CallbackResponse OnJoint ;
    DiscoveryResponse m_Info = null;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void OnJointClicked()
    {
        if (OnJoint != null && Info != null)
            OnJoint(Info);
        else
            MessageShow.Instance.Messaage("无效房间。");
    }
}
